package com.example.newnoke.ui;

import android.content.ClipboardManager;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.View;

import com.example.newnoke.R;
import com.example.newnoke.databinding.ActivityYqhyBinding;
import com.example.newnoke.mvp.presenter.TestPresenter;
import com.example.newnoke.mvp.view.ITestV;
import com.geya.jbase.baseactivity.BaseDetailsActivity;
import com.geya.jbase.uiview.ToastUtil;

public class InviteActivity extends BaseDetailsActivity<TestPresenter> implements ITestV {

    private ActivityYqhyBinding mBinding;
    private String url="";

    @Override
    public TestPresenter newPresenter() {
        return new TestPresenter(this);
    }

    @Override
    public void init() {
      url = getIntent().getStringExtra("url");
      mBinding.tvText.setText(url);
        mTitleButton.setTitles("邀请好友");
        mBinding.login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                // 将文本内容放到系统剪贴板里。
                cm.setText(url);
                ToastUtil.showShort("复制成功，可以分享给朋友们了。");
            }
        });
    }

    @Override
    public void setContentView() {
        mBinding = DataBindingUtil.setContentView(this,R.layout.activity_yqhy);
    }
}
